﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Easy.BLL;

namespace Easy.Web.Pages.EntityPages
{
    public partial class EntityLinkPage : System.Web.UI.Page
    {
        public string Entity;
        public string role;
        public List<Easy.Model.EntityLink> entitylinks;
        protected void Page_Load(object sender, EventArgs e)
        {
            Entity = Request.Params["etn"];
            role = Request.Params["role"];
            FormBaseBLL fbl = new FormBaseBLL(Entity);
            if (!IsPostBack)
            {
                entitylinks = fbl.getEntityLink(string.IsNullOrEmpty(role) ? "" : role);
            }
            if(Entity == null)
            {
                form2.Visible = false;
                Response.Write("实体不能为空！");
            }
        }

        protected void Save_Click(object sender, EventArgs e)
        {
            FormBaseBLL fbl = new FormBaseBLL(Entity);
            fbl.saveEntityLink(currentRoleId.Value, jsonContent_Save.Value);
            Response.Redirect(Request.Url.ToString()); 
        }
    }
    public class EntityLink
    {
        public string oid;
        public string oname;
        public string opid;
        public List<EntityLink> second;
    }
}